package com.zjhome.itoken.common.hystrix;

import com.google.common.collect.Lists;
import com.zjhome.itoken.common.constants.HttpStatusConstants;
import com.zjhome.itoken.common.dto.BaseResult;
import com.zjhome.itoken.common.utils.MapperUtils;


/**
 * 通用的熔断方法
 * @author 0283000121
 *
 */
public class Fallback {
	/**
	 * 502 
	 * @return
	 */
	public static String badGateway() {
		BaseResult result = BaseResult.notOk(Lists.newArrayList(
				new BaseResult.Error(
						String.valueOf(HttpStatusConstants.BAD_GATEWAY.getStatus()),
						HttpStatusConstants.BAD_GATEWAY.getContent()
						)
				));
		try {
			return MapperUtils.obj2json(result);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return null;
	}
}
